import request from '@/utils/request'
import type { SkuResponseData, SkuInfoData } from './type'
enum API {
    // 获取sku商品数据
    SKU_URl = '/admin/product/list/',
    // 上架
    SALE_URL = 'admin/product/onSale/',
    // 下架
    CANCELSALE_URL = 'admin/product/cancelSale/',
    // 获取商品详情的接口
    SKUINFO_URL = 'admin/product/getSkuInfo/',
    // 删除已有sku
    DELETESKU_URL = 'admin/product/deleteSku/'
}

// 获取sku商品数据
export const Allsku = (page: number, limit: number) => request.get<any, SkuResponseData>(API.SKU_URl + `/${page}/${limit}`)

// 上架
export const saleSku = (skuId: number) => request.get<any, any>(API.SALE_URL + skuId)

// 下架
export const cancelSale = (skuId: number) => request.get<any, any>(API.CANCELSALE_URL + skuId)

// 获取商品详情的接口
export const getSkuInfo = (skuId: number) => request.get<any, SkuInfoData>(API.SKUINFO_URL + skuId)

// 删除sku
export const removeSku = (skuId: number) => request.delete<any, any>(API.DELETESKU_URL + skuId)